Extract provider data properly (attempt 2) #148
Merged
+31
−37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the previous design, the server endpoint at the top-most level extracted the headers from the request and set provider data (e.g., private keys) that the implementations could retrieve using
get_request_provider_data()
.However, as Yogish has shown in #138, this is not sufficient. Consider the
/agents
API -- Together uses the standard "meta-reference" implementation for it but the inference provider is set to be Together. When an incoming request arrives, no "provider data validator" is registered for Agents because Agents isn't using the Together provider at all. However, when the agent calls inference as its dependency, the inference implementation does need the Together API key.The solution is straightforward:
NeedsRequestProviderData
).This design is more general and also allows for multiple providers needing multiple private keys to co-exist peacefully with each other.